home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-11-08 | 3.8 KB | 124 lines | [TEXT/PJMM] |
- {Generic Graphics Module}
-
- {A very simple graphics module for After Dark™}
- { This source file can be used as is for both Think Pascal 4.0 and MPW Pascal 3.0 }
- { by Patrick Beard and Bruce Burkhalter }
- { © 1989, 90, 91 Berkeley Systems Inc . }
-
- unit GraphicsDemo;
-
- interface
-
- uses
- Sound, GraphicsModuleTypes, AD_About_Box;
-
- function DoInitialize (var storage: Handle; blankRgn: rgnHandle; params: GMParamBlockPtr): OSErr;
-
- function DoBlank (storage: Handle; blankRgn: rgnHandle; params: GMParamBlockPtr): OSErr;
-
- function DoDrawFrame (storage: Handle; blankRgn: rgnHandle; params: GMParamBlockPtr): OSErr;
-
- function DoClose (storage: Handle; blankRgn: RgnHandle; params: GMParamBlockPtr): OSErr;
-
- function DoHelp (params: GMParamBlockPtr): OSErr;
-
- function DoSetup (blankRgn: rgnHandle; message: integer; params: GMParamBlockPtr): OSErr;
-
- implementation
-
- function DoInitialize (var storage: Handle; blankRgn: rgnHandle; params: GMParamBlockPtr): OSErr;
- begin
-
- {Allocate memory and initialize variables here}
-
- DoInitialize := noErr;
-
- end;
-
- function DoBlank (storage: Handle; blankRgn: rgnHandle; params: GMParamBlockPtr): OSErr;
-
- begin
-
- {Blank the screen. You could also have "credits" appear on the screen here}
-
- FillRgn(blankRgn, params^.qdGlobalsCopy^.qdBlack);
- DoBlank := noErr;
-
- end;
-
-
- function DoDrawFrame (storage: Handle; blankRgn: rgnHandle; params: GMParamBlockPtr): OSErr;
-
- begin
-
- {This function is repeatedly called by After Dark. This is where the main drawing is done.}
-
- DoDrawFrame := noErr;
-
- end;
-
- function DoClose (storage: Handle; blankRgn: RgnHandle; params: GMParamBlockPtr): OSErr;
- begin
-
- {Deallocate your memory here. You can also put something on the screen.}
-
- DoClose := noErr;
-
- end;
-
-
- {---------------DoHelp---------------------}
-
- function DoHelp (params: GMParamBlockPtr): OSErr;
- var
- PreferredFont, PreferredSize, TEXTID, CPICTID, BWPICTID, BWTextMode: integer;
- CMargins, BWMargins: Rect;
- RGBTEXTColor, RGBBackgroundColor: RGBColor;
- depth: integer;
- HelpWindowRect: Rect;
- AboutBoxGrafPtr: GrafPtr;
- begin
-
- DoHelp := noErr;
- GetPort(AboutBoxGrafPtr);
- HelpWindowRect := AboutBoxGrafPtr^.portRect; { The size of our window. }
- LocalToGlobal(HelpWindowRect.topLeft);
- LocalToGlobal(HelpWindowRect.botRight);
- FindShallowestMonitor(depth, HelpWindowRect, params);
-
- PreferredFont := 20; { Set your preferred font, 20 is Times. }
- PreferredSize := 12; { Set the type size in points. }
- TEXTID := 500; { Resource ID of the text. }
- CPICTID := 500; { Resource ID of the color PICT. }
- BWPICTID := 501; { Resource ID of the b&W PICT. }
-
- { Note that the resource file provided with this project doesn't actually have any PICT resources. }
- { They were left out to keep the project size small. When ADAB can't find a PICT resource it just }
- { uses the background color instead. }
-
- RGBTEXTColor.red := 0; { Set the text color for color mode. }
- RGBTEXTColor.green := 0;
- RGBTEXTColor.blue := 15000;
-
- RGBBackgroundColor.red := 45000; { Always set the background color in case the PICT resource }
- RGBBackgroundColor.green := 0; { is damage or can't be used for whatever reason. }
- RGBBackgroundColor.blue := 0;
-
- BWTextMode := 2; { Set the color of the text in black & white mode. 1 is white, 2 is black and 3 is inverted. }
-
- SetRect(CMargins, 20, 10, 20, 0); { Set your margins. CMargins.left is the number of pixels from }
- SetRect(BWMargins, 20, 10, 20, 0); { the left edge of the window, etc. CMargins is color mode, etc.}
-
- DoAboutBox(PreferredFont, PreferredSize, TEXTID, CPICTID, BWPICTID, BWTextMode, Depth, CMargins, BWMargins, RGBTEXTColor, RGBBackgroundColor);
- end;
-
- function DoSetup (blankRgn: rgnHandle; message: integer; params: GMParamBlockPtr): OSErr;
- begin
-
- {This is called when the used clicks on a button in the Control Panel.}
-
- DoSetup := noErr;
-
- end;
-
- end.